package com.budwk.app.util.poiUtils;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: wk-mini
 * @description: 导入数据监听器
 * @author: LJT
 * @create: 2023-10-19 15:02
 **/
public class SqfwInfoDataEasyExcelListener <T> extends AnalysisEventListener {

    private List<T> list = new ArrayList<>();

    @Override
    public void invoke(Object data, AnalysisContext analysisContext) {
        list.add((T) data);
    }

    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {
        System.out.println("所有数据解析完成！");
    }

    public List<T> getData() {
        return list;
    }

    /**
     * 清空数据
     */
    public void clear() {
        list.clear();
    }
}